package com.nulldev.util.web.nTubeExtensions.services.Deezer;

public enum AudioQuality {
	LOW_MPEG3(1, "mp3-lq"), // 128 kbps
	MEDIUM_MPEG3(5, "mp3-mq"), // 256 kbps
	HIGH_MPEG3(3, "mp3-hq"), // 320 kbps
	LOSSLESS_FLAC(9, "flac"), // ~1100 kbps

	M4A_RA1(15, "surr-hq"), // HQ
	M4A_RA2(14, "surr-mq"), // MQ
	M4A_RA3(13, "surr-lq"), // LQ

	VERY_LOW_MPEG3(10, "mp3-vlq"), // 64kbps MP3
	ULTRA_LOW_MPEG3(11, "mp3-ulq") // 32kbps MP3 [removed?]

	;

	public final int id;
	public final String sid;

	private AudioQuality(final int id, final String sid) {
		this.id = id;
		this.sid = sid;
	}

	public int id() {
		return this.id;
	}

	public String sid() {
		return this.sid;
	}

	public static AudioQuality get(final String sid) {
		if (sid == null || sid.isEmpty())
			return LOW_MPEG3;
		for (final AudioQuality aq : values()) {
			if (aq.sid.equalsIgnoreCase(sid))
				return aq;
		}
		return LOW_MPEG3;
	}
}
